﻿<%@ Page Title="Voluntarios" Language="C#" MasterPageFile="~/Include/MasterPage/MasterVoluntariar.Master"
    AutoEventWireup="true" CodeBehind="DetalhesUserMensagens.aspx.cs" Inherits="Voluntariar.WEB.DetalhesUserMensagens"
    Theme="Geral" %>

<%@ Register Src="~/Controls/AmigosUsuarios.ascx" TagName="AmigosUsuarios" TagPrefix="Uc2" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="cphMasterPrincipal">
    <script type="text/javascript">

        setInterval(function () {

            if (j('[id$=txtMensagem]').val() == "") {
                //myTimer()
            }

        }, 10000);
              

        function myTimer() {

            PageMethods.TimeOut(function (result) {
                if (result != null) {
                    var loc = window.location;
                    window.location = loc.protocol + "//" + loc.hostname + ":" + loc.port + loc.pathname;
                }
            });

        }
        
//        j(document).ready(function () 
//        {
//            j.ajax(
//            {
//                type: "POST",
//                contentType: "application/json",
//                data: "{}",
//                url: "ControlePrazo.aspx/Prazos",
//                dataType: "json",
//                success: function (data) 
//                {
//                   
//                },
//                error: function (XMLHttpRequest, textStatus, errorThrown) {
//                    debugger;
//                }
//            });
//        });  

    </script>
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <div id="divConteudo">
        <div class="titulo">
            <h1>
                Perfil do Usuário
            </h1>
            <div class="msg_vermelha">
                <%--* Campos de preenchimento obrigatório--%>
            </div>
        </div>
        <div class="descricao">
        </div>
        <div class="formulario" style="width: 100%;">
            <div class="caixa_formulario" style="width: 25%;">
                <fieldset style="width: 160px;">
                    <table cellpadding="2" cellspacing="2" width="100%">
                        <tr>
                            <td width="18%" valign="top" class="SkyBlueBorder" align="center">
                                <asp:Image ID="UserImage" runat="server" Width="140px" Height="140px" />
                            </td>
                        </tr>
                        <tr>
                            <td width="18%" valign="top" class="SkyBlueBorder" align="center">
                                <div class="linha_botoes">
                                    <asp:LinkButton ID="lnbMensagem" Style="font-size: 15px;" runat="server" OnClick="lnbMensagem_Click">Mensagem</asp:LinkButton>
                                </div>
                                <div class="linha_botoes">
                                    <asp:LinkButton ID="lnbEsqueciSenha" Style="font-size: 15px;" runat="server">Notificação</asp:LinkButton>
                                </div>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </div>
            <div class="caixa_formulario" style="width: 50%;">
                &nbsp;
                <asp:Panel runat="server" ID="pnl">
                    <asp:GridView ID="gdvMensagens" AutoGenerateColumns="false" ShowFooter="false" ShowHeader="false"
                        AllowPaging="false" runat="server" SkinID="gdvGridView" OnRowDataBound="gdvMensagens_RowDataBound"
                        OnRowCommand="gdvMensagens_RowCommand">
                        <Columns>
                            <asp:TemplateField HeaderStyle-CssClass="none" ItemStyle-CssClass="none" FooterStyle-CssClass="none">
                                <ItemTemplate>
                                    <asp:Label ID="lblusuarioOrigemID" runat="server" Text='<%# Eval("usuarioOrigem.ID") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-CssClass="none" ItemStyle-CssClass="none" FooterStyle-CssClass="none">
                                <ItemTemplate>
                                    <asp:Label ID="lblusuarioDestinoID" runat="server" Text='<%# Eval("usuarioDestino.ID") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="30%" HeaderText="Imagem"
                                ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:ImageButton ID="img" runat="server" ImageUrl='<%# getSRC(Convert.ToInt32(Eval("usuarioOrigem.ID").ToString()) , Convert.ToInt32(Eval("usuarioDestino.ID").ToString())) %>'
                                        Style="height: 30px; border: transparent; border-width: 4px; border-style: solid;
                                        width: 30px; float: left" />
                                    <asp:Label ID="lblMensagem" runat="server" Style="color: #172D3A;" SkinID="lblGeral"
                                        Text='<%# Eval("mensagem")%>'></asp:Label>
                                    <asp:Label ID="lblNome" runat="server" Style="color: #172D3A; font-size: x-small;"
                                        Text='<%# getNome(Convert.ToInt32(Eval("usuarioOrigem.ID").ToString())) %>'></asp:Label>
                                    <asp:Label ID="lblDataEnvio" runat="server" Style="font-style: italic; color: #172D3A;
                                        float: right;" Text='<%# Eval("dataEnvio")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <%--<asp:TemplateField HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="4%" HeaderText="Mensagem">
                                <ItemTemplate>
                                    <asp:Label ID="lblDataEnvio" runat="server" SkinID="lblGeral" Text='<%# Eval("dataEnvio")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>--%>
                            <asp:ButtonField Text="Editar" CommandName="Editar" ControlStyle-CssClass="none"
                                ItemStyle-CssClass="none">
                                <ItemStyle Width="4%" />
                            </asp:ButtonField>
                        </Columns>
                    </asp:GridView>
                </asp:Panel>
                <asp:Panel runat="server" ID="pgdvConversa" Visible="false">
                    <fieldset>
                        <legend>Conversa </legend>
                        <asp:GridView ID="gdvConversa" AutoGenerateColumns="false" ShowFooter="false" ShowHeader="false"
                            AllowPaging="false" runat="server" SkinID="gdvGridView" OnRowCommand="gdvConversa_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderStyle-CssClass="none" ItemStyle-CssClass="none" FooterStyle-CssClass="none">
                                    <ItemTemplate>
                                        <asp:Label ID="lblID" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderStyle-CssClass="none" ItemStyle-CssClass="none" FooterStyle-CssClass="none">
                                    <ItemTemplate>
                                        <asp:Label ID="lblusuarioOrigemID" runat="server" Text='<%# Eval("usuarioOrigem.ID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderStyle-CssClass="none" ItemStyle-CssClass="none" FooterStyle-CssClass="none">
                                    <ItemTemplate>
                                        <asp:Label ID="lblusuarioDestinoID" runat="server" Text='<%# Eval("usuarioDestino.ID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="30%" HeaderText="Imagem"
                                    ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="img" runat="server" ImageUrl='<%# getSRCConversa(Convert.ToInt32(Eval("usuarioOrigem.ID").ToString())) %>'
                                            Style="height: 30px; border: transparent; border-width: 4px; border-style: solid;
                                            width: 30px; float: left" />
                                        <asp:Label ID="lblMensagem" runat="server" Style="color: #172D3A; width: 318px; height: 46px;"
                                            SkinID="lblGeral" Text='<%# Eval("mensagem")%>'></asp:Label>
                                        <asp:Label ID="lblNome" runat="server" Style="color: #172D3A; font-size: x-small;"
                                            Text='<%# getNome(Convert.ToInt32(Eval("usuarioOrigem.ID").ToString())) %>'></asp:Label>
                                        <asp:Label ID="lblDataEnvio" runat="server" Style="margin-top: -36px; color: #172D3A;
                                            float: right;" Text='<%# Eval("dataEnvio")%>'></asp:Label>
                                        <asp:ImageButton ID="lnbExcluir" runat="server" Style="height: 30px; border: transparent;
                                            border-width: 4px; border-style: solid; width: 30px; float: left; margin-left: 70px;"
                                            ImageUrl="~/App_Themes/Geral/Imagem/trash-icon.png" OnClick="lnbExcluir_OnClick"
                                            CommandArgument='<%# Eval("ID") %>'></asp:ImageButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:ButtonField Text="Editar" CommandName="Editar" ControlStyle-CssClass="none"
                                    ItemStyle-CssClass="none">
                                    <ItemStyle Width="4%" />
                                </asp:ButtonField>
                            </Columns>
                        </asp:GridView>
                        <div class="caixa_formulario">
                            <asp:TextBox runat="server" SkinID="txtGeral" TextMode="MultiLine" ID="txtMensagem"
                                Style="margin: 13px; width: 415px; height: 60px;"></asp:TextBox>
                            <asp:LinkButton SkinID="lnbPrimario" runat="server" Style="margin-left: 13px; margin-top: -11px;"
                                ID="lnbEnviar" OnClick="lnbEnviar_OnClick">Enviar</asp:LinkButton>
                        </div>
                    </fieldset>
                </asp:Panel>
            </div>
            <div class="caixa_formulario" style="width: 25%;">
                &nbsp;
                <Uc2:AmigosUsuarios ID="AmigosUsuarios" runat="server" />
            </div>
        </div>
    </div>
</asp:Content>
